package model

import "github.com/fakeyanss/jt808-server-go/internal/codec/hex"

type Msg8300Param struct {
	Flag    uint8  `json:"-"`       // 标志
	Content string `json:"content"` // 文本信息，GBK，最大1024字节
}

// Msg8300 文本信息下发
type Msg8300 struct {
	Header *MsgHeader `json:"header"`
	Msg8300Param
}

func (m *Msg8300) Decode(packet *PacketData) error {
	return nil
}

func (m *Msg8300) Encode() (pkt []byte, err error) {
	pkt = hex.WriteByte(pkt, m.Flag)
	pkt = hex.WriteGBK(pkt, m.Content)

	pkt, err = writeHeader(m, pkt)
	return pkt, err
}

func (m *Msg8300) GetHeader() *MsgHeader {
	return m.Header
}

func (m *Msg8300) GenOutgoing(incoming JT808Msg) error {
	return nil
}
